package com.ruoyi.tester.domain;

import java.util.Date;
import java.util.Map;

/**
 * @author SongJun
 * @description TODO:
 * @date 2022/4/19 11:46
 */
public class InterfaceCallLog {
    private Long interfaceCallLogId;
    private Long taskCallLogId;
    private Long interfaceId;
    private String interfaceDesc;
    private String httpMethod;
    private String finalUrl;
    private String bodyParam;
    private String queryParam;
    private String contentType;
    private String headers;
    private String status;
    private String judgeExpression;
    private String response;
    private String responseHeaders;
    private String exception;
    private Date createTime;

    public InterfaceCallLog(TaskInterfaceEffectiveInfo interfaceInfo, Map<String, String> requestHeaders, String response, Map<String, String> responseHeaders, String exception){
        setTaskCallLogId(interfaceInfo.getTaskCallLogId());
        setInterfaceId(interfaceInfo.getInterfaceId());
        setInterfaceDesc(interfaceInfo.getInterfaceDesc());
        setHttpMethod(interfaceInfo.getHttpMethod());
        setFinalUrl(interfaceInfo.getFinalUrl());
        setBodyParam(interfaceInfo.getBodyParam());
        setQueryParam(interfaceInfo.getQueryParam());
        setContentType(interfaceInfo.getContentType());
        setHeaders(requestHeaders == null ? null : requestHeaders.toString());
        setResponse(response);
        setResponseHeaders(responseHeaders == null ? null : responseHeaders.toString());
        setCreateTime(new Date());
        setStatus(InterfaceCallStatus.FAULT);
        setJudgeExpression(interfaceInfo.getJudgeExpression());
        setException(exception);
    }

    public Long getInterfaceCallLogId() {
        return interfaceCallLogId;
    }

    public void setInterfaceCallLogId(Long interfaceCallLogId) {
        this.interfaceCallLogId = interfaceCallLogId;
    }

    public Long getTaskCallLogId() {
        return taskCallLogId;
    }

    public void setTaskCallLogId(Long taskCallLogId) {
        this.taskCallLogId = taskCallLogId;
    }

    public Long getInterfaceId() {
        return interfaceId;
    }

    public void setInterfaceId(Long interfaceId) {
        this.interfaceId = interfaceId;
    }

    public String getInterfaceDesc() {
        return interfaceDesc;
    }

    public void setInterfaceDesc(String interfaceDesc) {
        this.interfaceDesc = interfaceDesc;
    }

    public String getHttpMethod() {
        return httpMethod;
    }

    public void setHttpMethod(String httpMethod) {
        this.httpMethod = httpMethod;
    }

    public String getFinalUrl() {
        return finalUrl;
    }

    public void setFinalUrl(String finalUrl) {
        this.finalUrl = finalUrl;
    }

    public String getBodyParam() {
        return bodyParam;
    }

    public void setBodyParam(String bodyParam) {
        this.bodyParam = bodyParam;
    }

    public String getQueryParam() {
        return queryParam;
    }

    public void setQueryParam(String queryParam) {
        this.queryParam = queryParam;
    }

    public String getContentType() {
        return contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    public String getHeaders() {
        return headers;
    }

    public void setHeaders(String headers) {
        this.headers = headers;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getJudgeExpression() {
        return judgeExpression;
    }

    public void setJudgeExpression(String judgeExpression) {
        this.judgeExpression = judgeExpression;
    }

    public String getResponse() {
        return response;
    }

    public void setResponse(String response) {
        this.response = response;
    }

    public String getResponseHeaders() {
        return responseHeaders;
    }

    public void setResponseHeaders(String responseHeaders) {
        this.responseHeaders = responseHeaders;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getException() {
        return exception;
    }

    public void setException(String exception) {
        this.exception = exception;
    }
}
